
const app = getApp()
import { dateFormat } from '../utils/util.js'
Component({
    options: {
        addGlobalClass: true
    },
    data: {
        selected: 0,
        color: '#333',
        selectedColor: '#00D679',
        list: [{
            'pagePath': '/pages/index/index',
            'text': '首页',
            'iconPath': '../assets/img/tabBar/home.png',
            'selectedIconPath': '../assets/img/tabBar/home-active.png'
        },
        {
            'pagePath': '/pages/workbench/workbench',
            'text': '工作台',
            'iconPath': '../assets/img/tabBar/workbench.png',
            'selectedIconPath': '../assets/img/tabBar/workbench-active.png'
        },
        {
            'pagePath': '/pages/space/space',
            'text': '我的',
            'iconPath': '../assets/img/tabBar/my.png',
            'selectedIconPath': '../assets/img/tabBar/my-active.png'
        }
        ]
    },
    ready() {
        this.setData({
            selectStartDate: dateFormat('YYYY-mm-dd', new Date())
        })
    },
    methods: {
        switchTab(e) {
            // 震动反馈
            wx.vibrateShort({
                type: 'heavy'
            })
            const data = e.currentTarget.dataset
            const url = data.path
            wx.switchTab({
                url
            })
            this.setData({
                selected: data.index
            })
        }
    }
})
